<template>
    <div class="detail-box">
        <!-- 电影名称 -->
        <div class="film-name">{{info.filmName}}</div>
        <!-- 电影信息 stat-->
        <div class="film-info">
            <div class="film-tip">
                <div class="comment-count">
                    <div class="film-source">
                        <span class="star-img open"></span>
                        <span class="star-img open"></span>
                        <span class="star-img open"></span>
                        <span class="star-img close"></span>
                        <span class="star-img close"></span>
                        <span class="star-source">7.9</span>
                    </div>
                    <div class="star-count">93601短评</div>
                </div>
                <div class="film-desc">
                    <p>
                        <span>上映时间:</span>{{info.filmYear}}</p>
                    <p>
                        <span>电影类型:</span>{{info.filmTypes}}</p>
                    <p>
                        <span>参演明星:</span>{{info.castNames}}</p>
                </div>
            </div>
            <div class="film-img" :style="'background-image: url('+info.filmImg+')'"></div>
        </div>
        <!-- 电影信息 end-->
        <!-- 电影简介 start -->
        <div class="film-plot">
            <div class="plot-title">剧情简介</div>
            <div class="plot-content">{{info.filmDesc}}</div>
        </div>
        <!-- 电影简介 end -->
        <!-- 演员阵容 start -->
        <div class="film-actor">
            <div class="actor-title">导演演员</div>
            <div class="actor-list">
                <div class="actor-item" v-for="(actor, index) in castList" :key="index">
                    <div class="actor-img" :style="'background-image: url('+actor.photo+')'"></div>
                    <div class="actor-name">{{actor.name}}</div>
                </div>
            </div>
        </div>
        <!-- 演员阵容 end -->
        <!-- 电影评论 start -->
        <div class="film-comments">
            <div class="comment-title">相关评论</div>
            <div class="comment-list">
                <!-- 用户评论 start -->
                <comment-item></comment-item>
                <!-- 用户评论 end -->
            </div>
        </div>
        <!-- 电影评论 end -->
    </div>

</template>

<script src="../datas/detail.js"></script>
<script>
    Vue.component("detail-page", {
        template: document.currentScript.ownerDocument.querySelector("template"),
        data() {
            return {
                info: film.result,
                castList: {}
            };
        },
        mounted() {
            this.castList = JSON.parse(this.info.castList);
            // console.log(this.castList);
        },
    });
</script>